-
Notifications
You must be signed in to change notification settings - Fork 49.9k
[compiler] Support for member expression inc/decrement #30697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Test Plan: Builds support for a.x++ and friends. Similar to a.x += y, emits it as an assignment expression. [ghstack-poisoned]
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
| return { | ||
| kind: 'LoadLocal', | ||
| place: expr.node.prefix | ||
| ? {...newValuePlace} | ||
| : {...previousValuePlace}, | ||
| loc: exprLoc, | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be fine, but we try to avoid using lvalues more than once. The main exception is for method calls, where we evaluate the receiver to an lvalue, then use that lvalue to load the property for the method and again as the receiver of the method call instruction.
To test, can you add some fixtures where the increment/decrement is used as an rvalue? let x = obj.x++ and (obj.x++).toString()
josephsavona
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! Please see comments before landing with some additional things to test
Test Plan: Builds support for a.x++ and friends. Similar to a.x += y, emits it as an assignment expression. [ghstack-poisoned]
Stack from ghstack (oldest at bottom):
Test Plan:
Builds support for a.x++ and friends. Similar to a.x += y, emits it as an assignment expression.